package com.xiao.hao.controller.auth;


import com.xiao.hao.config.CheckParamsAnnotation;
import com.xiao.hao.constant.CheckParamsEnum;
import com.xiao.hao.facade.XhUserInfoFileFacade;
import com.xiao.hao.req.XhUserInfoFileInsertReq;
import com.xiao.hao.req.XhUserInfoFileQueryPageReq;
import com.xiao.hao.req.XhUserInfoFileUpdateReq;
import com.xiao.hao.resp.XhUserInfoFileResp;
import com.xiao.hao.utils.BaseId;
import com.xiao.hao.utils.PageResult;
import com.xiao.hao.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description 用户档案表 controller层
 * @Author xiaohao
 * @Date 2025-03-14 16:55:40
 */

@Api(tags = "用户档案表控制层")
@RestController
@Slf4j
@RequestMapping("xhUserInfoFile")
public class XhUserInfoFileController {


    @Resource
    private XhUserInfoFileFacade facade;

    @ApiOperation(value = "用户档案新增")
    @PostMapping("insert")
    @CheckParamsAnnotation(CheckParamsEnum.INSERT_CHECK)
    public Result insert(@RequestBody XhUserInfoFileInsertReq req) {
        return facade.insert(req);
    }

    @ApiOperation(value = "用户编辑和档案编辑")
    @PostMapping("update")
    @CheckParamsAnnotation(CheckParamsEnum.UPDATE_CHECK)
    public Result update(@RequestBody XhUserInfoFileUpdateReq req) {
        return facade.update(req);
    }

    @PostMapping("delete")
    @ApiOperation(value = "删除")
    public Result delete(@RequestBody BaseId req) {
        return facade.delete(req);
    }

    @ApiOperation(value = "用户子女分页查询")
    @PostMapping("queryPage")
    public PageResult queryPage(@RequestBody XhUserInfoFileQueryPageReq req) {
        return facade.queryPage(req);
    }

    @ApiOperation(value = "根据id查询登录人档案信息")
    @PostMapping("queryUserFile")
    public Result<XhUserInfoFileResp> queryUserFile(@RequestBody BaseId req) {
        return facade.queryUserFile(req);
    }


    @ApiOperation(value = "查询登录人全部档案信息")
    @PostMapping("queryUserFileNo")
    public Result<List<XhUserInfoFileResp>> queryUserFileNo() {
        return facade.queryUserFileNo();
    }
}


